package com.irdstudio.esaas.amcenter.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.irdstudio.esaas.amcenter.service.api.AppBaseInfoService;
import com.irdstudio.esaas.amcenter.service.vo.AppBaseInfoVO;
import com.irdstudio.ssm.framework.constant.ResponseData;
import com.irdstudio.ssm.framework.web.AbstractController;

@RestController
@RequestMapping("/api")
public class AppBaseInfoController extends AbstractController  {
	
	@Autowired
	@Qualifier("appBaseInfoServiceImpl")
	private AppBaseInfoService appBaseInfoService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/app/base/infos", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<AppBaseInfoVO>> queryAppBaseInfoAll(
			AppBaseInfoVO vo) {		
		List<AppBaseInfoVO> outputVo = appBaseInfoService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/app/base/info/{appId}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<AppBaseInfoVO> queryByPk(@PathVariable("appId") String appId) {		
		AppBaseInfoVO inVo = new AppBaseInfoVO();
				inVo.setAppId(appId);
		AppBaseInfoVO outputVo = appBaseInfoService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param appBaseInfo
	 * @return
	 */
	@RequestMapping(value="/app/base/info", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody AppBaseInfoVO inAppBaseInfoVo) {		
		int outputVo = appBaseInfoService.deleteByPk(inAppBaseInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inAppBaseInfoVo
	 * @return
	 */
	@RequestMapping(value="/app/base/info", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody AppBaseInfoVO inAppBaseInfoVo) {		
		int outputVo = appBaseInfoService.updateByPk(inAppBaseInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inAppBaseInfoVo
	 * @return
	 */
	@RequestMapping(value="/app/base/info", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertAppBaseInfo(@RequestBody AppBaseInfoVO inAppBaseInfoVo) {
		int outputVo = appBaseInfoService.insertAppBaseInfo(inAppBaseInfoVo);
		return getResponseData(outputVo);
		
	}
}
